//
//  ViewController.m
//  TRRecord
//
//  Created by CRY on 16/7/15.
//  Copyright © 2016年 CRY. All rights reserved.
//

#import "ViewController.h"
#import "Dog.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib
//    for (int i = 0; i < 100; i++) {
//        
//        Dog *dog = [[Dog alloc] init];
//        dog.name = [NSString stringWithFormat:@"dog%d",i];
//        dog.age = i;
//        dog.weight = random()%100;
//        [dog tr_saveToPersistentStoreAndWaitWithFinished:^{}];
//    }
//    NSLog(@"%@",[Dog tr_findAll]);
//    NSLog(@"%@",[Dog tr_findByParameters:nil
//                      orderedByAttribute:@"name"
//                               ascending:YES]);
    
    NSLog(@"%@",[Dog tr_findByParameters:@[@"age < 10",
                                           @"age > 3"]
                      orderedByAttribute:nil
                               ascending:YES
                                   limit:3
                                  offset:3]);
//    select * from users order by id limit 10 offset 0;
//
//    for (int i = 0; i < 100; i++) {
//        
//        Dog *dog = [[Dog alloc] init];
//        dog.name = [NSString stringWithFormat:@"dog%d",i];
//        dog.age = i;
//        [dog tr_deleteWithFinished:nil];
//    }
//    NSLog(@"%@",[Dog tr_findAll]);
//    NSLog(@"%@",[Dog tr_findFirstOrderedByAttribute:@"name"
//                                          ascending:NO]);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
